// task21.cpp: 定义控制台应用程序的入口点。
//

#include "stdafx.h"


#include <iostream>
#include <string>
using namespace std;
class Student
{
private:
	int number;
	string name;
public:
	Student()
	{
		number = -1;
		name = "无名氏.";
	}

	void setdata()
	{
		cout << "请输入学号：." << endl;
		cin >> number;
		cout << "请输入姓名：." << endl;
		cin >> name;
	}
	void showdata()
	{
		cout << "学号：." << number << endl;
		cout << "姓名：." << name << endl;
	}
};
class Class
{
private:
	string class_name;
	int stu_num;
	Student *p;
public:
	Class()
	{
		class_name = ' ';
		stu_num = 0;
		p = new Student;
	}
	Class(Student *p_stu, int stu_num)
	{
		cout << "请输入班级名称:." << endl;
		cin >> class_name;
		p = p_stu;
	}
	~Class()
	{
		delete[]p;
	}
	void show()
	{
		int i;
		for (i = 0; i < stu_num; i++)
		{
			(p + i)->showdata();
		}
	}
};
Class* banji()
{
	int stu_num;
	cout << "请输入班级学生数量：." << endl;
	cin >> stu_num;
	Student *stu = new Student[stu_num];
	int i;
	for (i = 0; i < stu_num; i++)
	{
		(stu + i)->setdata();
	}
	Class *class1 = new Class(stu, stu_num);
	return class1;
}
int main()
{
	Class *class1;
	class1 = banji();
	class1->show();
	return 0;
}
